package com.keeping.aiimagery.service.impl;

import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.keeping.aiimagery.entity.ChatRecord;
import com.keeping.aiimagery.mapper.ChatRecordMapper;
import com.keeping.aiimagery.service.ChatRecordService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created By Ranger on 2023/4/4.
 */
@Service
public class ChatRecordServiceImpl extends ServiceImpl<ChatRecordMapper, ChatRecord> implements ChatRecordService {
    
    @Override
    public List<ChatRecord> listByRoomId(Long roomId, Long userId) {
        return new LambdaQueryChainWrapper<>(baseMapper)
                .eq(ChatRecord::getRoomId,roomId)
                .eq(ChatRecord::getCreatedBy,userId)
                .orderByAsc(ChatRecord::getCreatedTime)
                .list();
    }
}
